package cn.car.Util;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;


/**
 * 文件操作类
 * 
 * @author hanzhg 2011-11-15 下午03:14:30
 * 
 */
public class FileMange {
	public static String getStringFromFile(String filename, String encoding) {
		StringBuffer input = new StringBuffer();
		InputStream in = FileMange.class.getResourceAsStream(filename);
		BufferedReader isr;
		try {
			isr = new BufferedReader(new InputStreamReader(in, encoding));
			String line = isr.readLine();
			while (line != null) {
				input.append(line);
				line = isr.readLine();
			}
			return input.toString();
		} catch (Exception e) {
			e.printStackTrace();
//			new MSException(e.getMessage(),e);
		}
		return null;
	}
}
